//
//  RealTableViewCell.m
//  Music
//
//  Created by dllo on 16/6/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "RealTableViewCell.h"

@implementation RealTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picUrl = [[UIImageView  alloc] init];
        [self.contentView  addSubview:_picUrl];
        
        self.name = [[UILabel  alloc] init];
        self.name.font =  [UIFont  fontWithName:@"Helvetica-Oblique" size:14];
        [self.contentView  addSubview:_name];
        
        self.desc = [[UILabel  alloc] init];
        self.desc.font =  [UIFont  fontWithName:@"Helvetica-Oblique" size:12];
        [self.contentView  addSubview:_desc];
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.picUrl.frame = CGRectMake(8, 8, (Screenwidth-16)/3, 80);
    self.name.frame = CGRectMake(self.picUrl.frame.origin.x+self.picUrl.frame.size.width+5, self.picUrl.frame.origin.y, 180, 30);
    self.desc.frame = CGRectMake(self.name.frame.origin.x, self.name.frame.origin.y+self.name.frame.size.height+10, self.name.frame.size.width+50, 10);
    
    
}
-(void)setModel:(smallModel *)model
{
    if (_model != model) {
        _model = model;
        
   }
    [self.picUrl  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    
    self.name.text = model.name;
    self.desc.text = model.desc;
    
}




- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
